var Nc = {};
/**
 * 判断是否是数组
 */
Nc.isArray = function(obj) {
    return Array.isArray(obj);
};
/**
 * 判断是否是对象
 */
Nc.isObject = function(obj) {
    var type = typeof obj;
    return type === 'function' || type === 'object' && !!obj;
};
/**
 * 其他类型的判断
 * 'RegExp', 'Error' 这2个没加
 */
['Function', 'String', 'Number', 'Date', 'Boolean'].forEach(function(value) {
    Nc['is' + value] = function(obj) {
        return Object.prototype.toString.call(obj) === '[object ' + value + ']';
    };
});
/**
 * 是否为空
 */
Nc.isEmpty = function(obj) {
    if (Nc.isBoolean(obj)) return !obj;
    if (obj == null) return true;
    if (Nc.isNumber(obj)) {
        return obj <= 0;
    }
    if (Nc.isArray(obj) || Nc.isString(obj) || (obj instanceof jQuery)) return obj.length === 0;
    return Object.keys(obj).length === 0;
};

function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return r[2];
    return '';
}

function addCookie(name, value, expireHours) {
    var cookieString = name + "=" + escape(value) + "; path=/";
    //判断是否设置过期时间
    if (expireHours > 0) {
        var date = new Date();
        date.setTime(date.getTime() + expireHours * 3600 * 1000);
        cookieString = cookieString + ";expires=" + date.toGMTString();
    }
    document.cookie = cookieString;
}

function getCookie(name) {
    var strcookie = document.cookie;
    var arrcookie = strcookie.split("; ");
    for (var i = 0; i < arrcookie.length; i++) {
        var arr = arrcookie[i].split("=");
        if (arr[0] == name) return unescape(arr[1]);
    }
    return null;
}

function delCookie(name) { //删除cookie
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null) document.cookie = name + "=" + cval + "; path=/;expires=" + exp.toGMTString();
}
/**
 * 获取token
 */
function getMemberToken() {
    var token = getCookie('key');
    if (token) {
        return token;
    } else {
        return "";
    }
}
/**
 * 取得客户端类型
 */

function getClientType() {
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf('micromessenger') > -1) {
        return "wechat";
    } else if (ua.indexOf('amezios') > -1) {
        return "ios";
    } else if (ua.indexOf('amezandroid') > -1) {
        return "android";
    } else {
        return "wap";
    }
}

/**
 * 点击处理
 */
function tapConfig() {
    document.documentElement.style.webkitTapHighlightColor = 'rgba(0,0,0,0)';
    document.documentElement.style.webkitUserSelect = 'none';
    document.documentElement.style.webkitTouchCallout = 'none';
}

/**
 * 判断是否为APP
 */
function isApp() {
    return (getClientType() == "ios" || getClientType() == "android");
}

/**
 * 通过cookie验证是否登录
 * @param isMustLogin 0表示页面不是必须登录页面，1表示页面必须登录后才能访问
 * @param referrerUrl 登录成功后跳转的页面地址
 * @returns {*}
 */
function checkLoginByCookie(isMustLogin, referrerUrl) {
    var token = getCookie('key');
    if (token) {
        return token;
    } else {
        //查询是否开启了微信登录
        var weixinLogin = 0;
        if (getClientType()=="wechat") {
            $.ajax({
                url:ApiUrl + '/loginconnect/state',
                type:'get',
                async:false,
                success:function(result){
                    if (result.datas.weixinLogin == 1) {
                        weixinLogin = 1;
                    }
                }
            });
        }
        if (referrerUrl) {
            addCookie("referurl", referrerUrl, 0);
        }else{
            addCookie("referurl", window.location.href, 0);
        }
        if (getClientType()=="wechat" && weixinLogin==1 && getCookie('hasAutologin')!=1) {
            //微信端且开启了微信登录且未经过自动登录则进行静默授权登录，并防止重复执行自动登录形成死循环
            window.location.href = ApiUrl + '/loginconnect/wap/weixin/auto';
            return;
        } else {
            if (isMustLogin==1) {
                window.location.href = WapSiteUrl + '/tmpl/member/login.html';
                return;
            }
        }
        return "";
    }
}

/**
 * 退出登录 , 并跳转到登录页面
 */
function signOut() {
    var key = getMemberToken();
    $.ajax({
        type: 'post',
        url: ApiUrl + '/logout',
        data: {
            token: key
        },
        success: function(result) {
            if (result.code == 200) {
                delCookie('username');
                delCookie('key');
                location.href = WapSiteUrl + '/tmpl/member/login.html';
            }
        }
    });
}

function contains(arr, str) {
    var i = arr.length;
    while (i--) {
        if (arr[i] === str) {
            return true;
        }
    }
    return false;
}
/**
 * 图片调用
 * @param imageName
 * @param width
 * @param height
 * @returns {*}
 */
function ncImage(imageName, width, height) {
    if (!imageName) {
        return "";
    }
    var point = imageName.lastIndexOf(".");
    var type = imageName.substr(point);
    if (type == ".jpg" || type == ".gif" || type == ".png") {
        return imageName + "@" + width + "w_" + height + "h";
    } else {
        return imageName;
    }
}

function buildUrl(type, data) {
    if (Nc.isEmpty(type)) {
        return "javascript:;";
    }
    switch (type) {
        case 'keyword':
            return WapSiteUrl + '/tmpl/product_list.html?keyword=' + encodeURIComponent(data);
        case 'distKeyword' :
            return WapSiteUrl + '/tmpl/distribution_product_list.html?keyword=' + encodeURIComponent(data) ; 
        case 'keywordStore':
            return WapSiteUrl + '/tmpl/store_list.html?keyword=' + encodeURIComponent(data);
        case 'special':
            return WapSiteUrl + '/tmpl/special.html?specialId=' + data;
        case 'special_list':
            return WapSiteUrl + '/tmpl/special_list.html?specialId=' + data;
        case 'goods':
            return WapSiteUrl + '/tmpl/product_detail.html?commonId=' + data;
        case 'store':
            return WapSiteUrl + '/tmpl/store.html?storeId=' + data;
        case 'gate':
            return WapSiteUrl + '/tmpl/gate_list.html?keyword=' + encodeURIComponent(data);
        case 'store_goods':
            return WapSiteUrl + '/tmpl/store_goods.html?storeId=' + data;
        case 'dist':
            return WapSiteUrl + '/tmpl/product_detail.html?commonId=' +data+ '&distributionGoodsId='+ arguments[2];
        case 'distPage':
            return WapSiteUrl + '/tmpl/distribution_product_list.html?sort=commission_desc';
        case 'my':
            return WapSiteUrl + '/tmpl/member/member.html';
        case 'integral':
            return WapSiteUrl + '/tmpl/integral.html';
        case 'category':
            return WapSiteUrl + '/tmpl/category.html';
        case 'cart':
            return WapSiteUrl + '/tmpl/cart_list.html';
        case 'setting':
            return WapSiteUrl + '/tmpl/member/member_account.html'; 
        case 'coupons':
            return WapSiteUrl + '/tmpl/coupons_list.html';
        case 'ecard':
            return WapSiteUrl + '/tmpl/ecard.html';
        case 'onecard':
            return WapSiteUrl + '/tmpl/onecard.html';
        case 'url':
            return data;
    }
    return WapSiteUrl;
}

function buildStoreUrl(type, data, storeId) {
    switch (type) {
        case 'storeKeyword':
            return WapSiteUrl + '/tmpl/store_goods.html?storeId=' + storeId + '&keyword=' + encodeURIComponent(data);
        case 'storeSpecial':
            return WapSiteUrl + '/tmpl/store_special.html?specialId=' + data;
        case 'goods':
            return WapSiteUrl + '/tmpl/product_detail.html?commonId=' + data;
        default:
            return "javascript:;";
    }
    return WapSiteUrl;
}

function errorTipsShow(html) {
    $(".error-tips").html(html).show();
    setTimeout(function() {
        errorTipsHide();
    }, 3000);
}

function errorTipsHide() {
    $(".error-tips").html("").hide();
}

function writeClear(o) {
    if (o.val().length > 0) {
        o.parent().addClass('write');
    } else {
        o.parent().removeClass('write');
    }
    btnCheck(o.parents('form'));
}

/**
 * 表单输入验证，form中的input全部输入数值才能提交。
 * 添加no-follow属性可排除该input
 * @param form
 */
function btnCheck(form) {
    var btn = true;
    form.find('input').each(function() {
        if ($(this).hasClass('no-follow')) {
            return;
        }
        if ($(this).val().length == 0) {
            btn = false;
        }
    });
    if (btn) {
        form.find('.btn').parent().addClass('ok');
    } else {
        form.find('.btn').parent().removeClass('ok');
    }
}


/**
 * 取得默认系统搜索关键词
 * @param cmd
 */
function getSearchName() {
    var keyword = decodeURIComponent(getQueryString('keyword'));
    if (keyword == '') {
        if (getCookie('deft_key_value') == null) {
            $.getJSON(ApiUrl + '/search/hot/keyword', function(result) {
                var data = result.datas;
                if (result.code == 200) {
                    if (typeof data.keywordName != 'undefined') {
                        $('#keyword').attr('placeholder', data.keywordName);
                        $('#keyword').html(data.keywordName);
                        addCookie('deft_key_name', data.keywordName, 1);
                        addCookie('deft_key_value', data.keywordValue, 1);
                    } else {
                        addCookie('deft_key_name', '', 1);
                        addCookie('deft_key_value', '', 1);
                    }
                }
            })
        } else {
            $('#keyword').attr('placeholder', getCookie('deft_key_name'));
            $('#keyword').html(getCookie('deft_key_name'));
        }
    }
}
/**
 * 清空搜索历史
 * @param
 */
function hisSearchClean(){
    addCookie("historySearch1","",24);
}

/**
 * 查询是否有新消息
 */
function getChatCount() {
    if ($('#header').find('.message').length > 0) {
        var key = getCookie('key');
        if (!IMUrl) return;
        if (key !== null) {
            $.post(IMUrl + '/get_unread_msg_count', {
                token: key,
                ctype :'wap'
            }, function(result) {
                if (result.datas > 0) {
                    $('#header').find('.message').parent().find('sup').show();
                    $('#header-nav').find('sup').show();
                }
            },'json');
        }
        $('#header').find('.message').parent().click(function() {
            window.location.href = WapSiteUrl + '/tmpl/member/chat_list.html';
        });
    }
}

$(function() {
    $('.input-del').click(function() {
        $(this).parent().removeClass('write').find('input[type!="hidden"]').val('');
        btnCheck($(this).parents('form'));
    });
	
  // radio样式
    $('body').on('click', 'label', function() {
        if ($(this).has('input[type="radio"]').length > 0) {
            $(this).addClass('checked').siblings().removeAttr('class').find('input[type="radio"]').removeAttr('checked');
        } else if ($(this).has('[type="checkbox"]')) {
            if ($(this).find('input[type="checkbox"]').prop('checked')) {
                $(this).addClass('checked');
            } else {
                $(this).removeClass('checked');
            }
        }
    });
    // 滚动条通用js
    if ($('body').hasClass('scroller-body')) {
        new IScroll('.scroller-body', {
            mouseWheel: true,
            click: true
        });
    }

    // 右上侧小导航控件
    $('#header').on('click', '#header-nav', function() {
        if ($('.nctouch-nav-layout').hasClass('show')) {
            $('.nctouch-nav-layout').removeClass('show');
        } else {
            $('.nctouch-nav-layout').addClass('show');
        }
    });
    $('#header').on('click', '.nctouch-nav-layout', function() {
        $('.nctouch-nav-layout').removeClass('show');
    });
    $(document).scroll(function() {
        $('.nctouch-nav-layout').removeClass('show');
    });
    getSearchName();
    getChatCount(); // 导航右侧消息


    //回到顶部
    $(document).scroll(function() {
        set();
    });
    $('.fix-block-r,footer').on('click', "#goTopBtn", function() {
        btn = $(this)[0];
        this.timer = setInterval(function() {
            $(window).scrollTop(Math.floor($(window).scrollTop() * 0.8));
            if ($(window).scrollTop() == 0) clearInterval(btn.timer, set);
        }, 10);
    });

    function set() {
        $(window).scrollTop() == 0 ? $('#goTopBtn').addClass('hide') : $('#goTopBtn').removeClass('hide');
    }
});
(function($) {
    $.extend($, {
        /**
         * 滚动header固定到顶部
         */
        scrollTransparent: function(options) {
            var defaults = {
                valve: '#header', // 动作触发
                scrollHeight: 50
            }
            var options = $.extend({}, defaults, options);

            function _init() {
                $(window).scroll(function() {
                    if ($(window).scrollTop() <= options.scrollHeight) {
                        $(options.valve).addClass('transparent').removeClass('posf');
                    } else {
                        $(options.valve).addClass('posf').removeClass('transparent');
                    }
                });

            }
            return this.each(function() {
                _init();
            })();
        },

        /**
         * 选择地区
         * 
         * @param $
         */
        areaSelected: function(options) {
            var defaults = {
                success: function(data) {}
            }
            var options = $.extend({}, defaults, options);
            var ASID = 0;
            var ASID_1 = 0;
            var ASID_2 = 0;
            var ASID_3 = 0;
            var ASNAME = '';
            var ASINFO = '';
            var ASDEEP = 1;
            var ASINIT = true; 
            //bycj -- 添加完成标识
            var isEnd = false ; 

            function _init() {
                if ($('#areaSelected').length > 0) {
                    $('#areaSelected').remove();
                }
                var html = '<div id="areaSelected">' + '<div class="nctouch-full-mask left">' + '<div class="nctouch-full-mask-bg"></div>' + '<div class="nctouch-full-mask-block">' + '<div class="header">' + '<div class="header-wrap">' + '<div class="header-l"><a href="javascript:void(0);"><i class="back"></i></a></div>' + '<div class="header-title">' + '<h1>选择地区</h1>' + '</div>' + '<div class="header-r"><a href="javascript:void(0);"><i class="close"></i></a></div>' + '</div>' + '</div>' + '<div class="nctouch-main-layout">' + '<div class="nctouch-single-nav">' + '<ul id="filtrate_ul" class="area">' + '<li class="selected"><a href="javascript:void(0);">一级地区</a></li>' + '<li><a href="javascript:void(0);" >二级地区</a></li>' + '<li><a href="javascript:void(0);" >三级地区</a></li>' + '</ul>' + '</div>' + '<div class="nctouch-main-layout-a"><ul class="nctouch-default-list"></ul></div>' + '</div>' + '</div>' + '</div>' + '</div>';
                $('body').append(html);
                _getAreaList();
                _bindEvent();
                _close();
            }

            function _getAreaList() {
                $.ajax({ //获取区域列表
                    type: 'get',
                    url: ApiUrl + '/area/list',
                    data: {
                        areaId: ASID
                    },
                    dataType: 'json',
                    async: false,
                    success: function(result) { 
                        if (result.code !=200 || result.datas.areaList.length == 0) {
                            _finish();
                            return false;
                        }
                        if (ASINIT) {
                            ASINIT = false
                        } else {
                            ASDEEP++;
                        }
                        $('#areaSelected').find('#filtrate_ul').find('li').eq(ASDEEP - 1).addClass('selected').siblings().removeClass('selected');
                        //checkLogin(result.login);
                        var data = result.datas;
                        var area_li = '';
                        for (var i = 0; i < data.areaList.length; i++) {
                            area_li += '<li><a href="javascript:void(0);" data-id="' + data.areaList[i].areaId + '" data-name="' + data.areaList[i].areaName + '"><h4>' + data.areaList[i].areaName + '</h4><span class="arrow-r"></span> </a></li>';
                        }
                        $('#areaSelected').find(".nctouch-default-list").html(area_li);
                        if (typeof(myScrollArea) == 'undefined') {
                            if (typeof(IScroll) == 'undefined') {
                                $.ajax({
                                    url: WapSiteUrl + '/js/iscroll.js',
                                    dataType: "script",
                                    async: false
                                });
                            }
                            myScrollArea = new IScroll('#areaSelected .nctouch-main-layout-a', {
                                mouseWheel: true,
                                click: true
                            });
                        } else {
                            myScrollArea.destroy();
                            myScrollArea = new IScroll('#areaSelected .nctouch-main-layout-a', {
                                mouseWheel: true,
                                click: true
                            });
                        }
                    }
                });
                return false;
            }

            function _bindEvent() {
                // $('#areaSelected').find('.nctouch-default-list').off('click', 'li > a');
                $('#areaSelected').find('.nctouch-default-list').on('click', 'li > a', function() {
                    if (isEnd) return ; 

                    ASID = $(this).attr('data-id');
                    eval("ASID_" + ASDEEP + "=$(this).attr('data-id')");
                    ASNAME = $(this).attr('data-name');
                    ASINFO += ASNAME + ' ';
                    var _li = $('#areaSelected').find('#filtrate_ul').find('li').eq(ASDEEP);
                    _li.prev().find('a').attr({
                        'data-id': ASID,
                        'data-name': ASNAME
                    }).html(ASNAME);
                    if (ASDEEP == 3) {

                        _finish();
                        return false;
                    }
                    _getAreaList();
                });
                $('#areaSelected').find('#filtrate_ul').off('click', 'li > a');
                $('#areaSelected').find('#filtrate_ul').on('click', 'li > a', function() {
                    if ($(this).parent().index() >= $('#areaSelected').find('#filtrate_ul').find('.selected').index()) {
                        return false;
                    }
                    //bycj -- 调整
                    var $a = $(this).parent().prev().find('a') ;
                    ASID = $a.attr("data-id") ||  0; 
                    ASNAME = $a.attr('data-name') || 0 ;

                    // ASID = $(this).parent().prev().find('a').attr('data-id');
                    // ASNAME = $(this).parent().prev().find('a').attr('data-name');
                    ASDEEP = $(this).parent().index();
                    ASINFO = '';
                    for (var i = 0; i < $('#areaSelected').find('#filtrate_ul').find('a').length; i++) {
                        if (i < ASDEEP) {
                            ASINFO += $('#areaSelected').find('#filtrate_ul').find('a').eq(i).attr('data-name') + ' ';
                        } else {
                            var text = '';
                            switch (i) {
                                case 0:
                                    text = '一级地区'
                                    break;
                                case 1:
                                    text = '二级地区'
                                    break;
                                case 2:
                                    text = '三级地区';
                                    break;
                            }
                            $('#areaSelected').find('#filtrate_ul').find('a').eq(i).html(text);
                        }
                    }
                    _getAreaList();
                });
            }

            function _finish() {
                var data = {
                    area_id: ASID,
                    area_id_1: ASID_1,
                    area_id_2: ASID_2,
                    area_id_3: ASID_3,
                    area_name: ASNAME,
                    area_info: ASINFO
                };
                options.success.call('success', data);
                if (!ASINIT) {
                    $('#areaSelected').find('.nctouch-full-mask').addClass('right').removeClass('left');
                }
                //bycj -- 修改完成标识
                isEnd = true ; 
                return false;
            }

            function _close() {
                $('#areaSelected').find('.header-l').off('click', 'a');
                $('#areaSelected').find('.header-l').on('click', 'a', function() {
                    $('#areaSelected').find('.nctouch-full-mask').addClass('right').removeClass('left');
                });
                return false;
            }

            return this.each(function() {
                return _init();
            })();
        },



        /**
         * 从右到左动态显示隐藏内容
         * 
         */
        animationLeft: function(options, cb) {
            var defaults = {
                valve: '.animation-left', // 动作触发
                wrapper: '.nctouch-full-mask', // 动作块
                scroll: '' // 滚动块，为空不触发滚动
            }
            var myScrollAnimationLeft;
            var options = $.extend({}, defaults, options);

            function _init() {
                $(options.valve).click(function() {
                    $(options.wrapper).removeClass('hide').removeClass('right').addClass('left');

                    if (options.scroll != '') {
                        if (typeof(myScrollAnimationLeft) == 'undefined') {
                            if (typeof(IScroll) == 'undefined') {
                                $.ajax({
                                    url: WapSiteUrl + '/js/iscroll.js',
                                    dataType: "script",
                                    async: false
                                });
                            }
                            myScrollAnimationLeft = new IScroll(options.scroll, {
                                mouseWheel: true,
                                click: true
                            });
                        } else {
                            myScrollAnimationLeft.refresh();
                        }
                        cb &&cb(myScrollAnimationLeft);
                    }
                });
                $(options.wrapper).on('click', '.header-l > a', function() {
                    $(options.wrapper).addClass('right').removeClass('left');
                });

            }
            return this.each(function() {
                _init();
            })();
        },

        /**
         * 从下到上动态显示隐藏内容
         * 
         */
        animationUp: function(options) {
            var defaults = {
                valve: '.animation-up', // 动作触发，为空直接触发
                wrapper: '.nctouch-bottom-mask', // 动作块
                scroll: '.nctouch-bottom-mask-rolling', // 滚动块，为空不触发滚动
                start: function() {}, // 开始动作触发事件
                close: function() {} // 关闭动作触发事件
            }
            var options = $.extend({}, defaults, options);

            function _animationUpRun() {
                options.start.call('start');
                $(options.wrapper).removeClass('down').addClass('up');

                if (options.scroll != '') {
                    if (typeof(myScrollAnimationUp) == 'undefined') {
                        if (typeof(IScroll) == 'undefined') {
                            $.ajax({
                                url: WapSiteUrl + '/js/iscroll.js',
                                dataType: "script",
                                async: false
                            });
                        }
                        myScrollAnimationUp = new IScroll(options.scroll, {
                            mouseWheel: true,
                            click: true
                        });
                    } else {
                        myScrollAnimationUp.refresh();
                    }
                }
            }
            return this.each(function() {
                if (options.valve != '') {
                    $(options.valve).on('click', function() {
                        _animationUpRun();
                    });
                } else {
                    _animationUpRun();
                }
                $(options.wrapper).on('click', '.nctouch-bottom-mask-bg,.nctouch-bottom-mask-close,.nctouch-bottom-mask-tip', function() {
                    $(options.wrapper).addClass('down').removeClass('up');
                    options.close.call('close');
                });
            })();
        }
    });
})(jQuery);

/**
 * 异步上传图片
 */
$.fn.ajaxUploadImage = function(options) {
    var defaults = {
        url: '',
        data: {},
        start: function() {}, // 开始上传触发事件
        success: function() {}
    }
    var options = $.extend({}, defaults, options);
    var _uploadFile;

    function _checkFile() {
        //文件为空判断
        if (_uploadFile === null || _uploadFile === undefined) {
            alert("请选择您要上传的文件！");
            return false;
        }
        //           
        //          //检测文件类型
        //          if(_uploadFile.type.indexOf('image') === -1) {
        //              alert("请选择图片文件！");
        //              return false;
        //          }
        //           
        //          //计算文件大小
        //          var size = Math.floor(_uploadFile.size/1024);
        //          if (size > 5000) {
        //              alert("上传文件不得超过5M!");
        //              return false;
        //          };
        return true;
    };
    return this.each(function() {
        $(this).on('change', function() {
            var _element = $(this);
            options.start.call('start', _element);
            _uploadFile = _element.prop('files')[0];
            if (!_checkFile) return false;
            try {
                //执行上传操作
                var xhr = new XMLHttpRequest();
                xhr.open("post", options.url, true);
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4) {
                        returnDate = $.parseJSON(xhr.responseText);
                        options.success.call('success', _element, returnDate);
                    };
                };
                //表单数据
                var fd = new FormData();
                for (k in options.data) {
                    fd.append(k, options.data[k]);
                }
                fd.append(_element.attr('name'), _uploadFile);
                //执行发送
                result = xhr.send(fd);
            } catch (e) {
                console.log(e);
                alert(e);
            }
        });
    });
} ; 
/**
 * 不需要input的上传文件
 */
function uploadNoInput(options) {
    var defaults = {
        url: '',
        data: {},
        start: function() {}, // 开始上传触发事件
        success: function() {}
    };
    var _uploadFile, hideInput,options = $.extend({}, defaults, options),
        //删除input
        _removeInput = function() {
            $("#hideUploadFile").length && $("#hideUploadFile").remove()
        };

    _removeInput();
    //添加一个隐藏的input
    hideInput = $('<input id="hideUploadFile" style="opacity:0;" name="file" type="file"/>')
    .on('change', function(event) {
        event.preventDefault();

        var _element = $(this);
        options.start.call('start', _element);
        _uploadFile = _element.prop('files')[0];


        if (_uploadFile === null || _uploadFile === undefined) {
            alert("请选择您要上传的文件！");
            return false;
        }
        try {
            //执行上传操作
            var xhr = new XMLHttpRequest();
            xhr.open("post", options.url, true);
            xhr.onreadystatechange = function() {
                if (xhr.readyState == 4) {
                    returnDate = $.parseJSON(xhr.responseText);
                    options.success.call('success', _element, returnDate);
                    _removeInput();
                };
            };
            //表单数据
            var fd = new FormData();
            for (k in options.data) {
                fd.append(k, options.data[k]);
            }
            fd.append(_element.attr('name'), _uploadFile);
            //执行发送
            result = xhr.send(fd);
        } catch (e) {
            console.log(e);
            alert(e);
        }
        _removeInput();

    });

    // $('<a href="javascript:;" id="clickUpload"></a>').appendTo('body') ;
    $("body").append(hideInput);
    // $("#clickUpload").on('click', function(event) {
    //     event.preventDefault();
    //     hideInput.click();
    //     /* Act on the event */
    // });
    // $("#clickUpload").trigger('click');
    hideInput.trigger('click');
}

function loadSeccode() {
    $("#captchaKey").val('');
    //加载验证码
    $.ajax({
        type: 'get',
        url: ApiUrl + "/captcha/makecaptchakey",
        async: false,
        dataType: 'json',
        success: function(result) {
            $("#captchaKey").val(result.datas.captchaKey);
        }
    });
    $("#captchaImage").attr('src', ApiUrl + '/captcha/makecaptcha?captchaKey=' + $("#captchaKey").val() + '&clientType=' + getClientType() + '&t=' + Math.random());
}
/**
 * 收藏店铺
 */
function favoriteStore(storeId) {
    var key = checkLoginByCookie(1);
    if (storeId <= 0) {
        $.sDialog({
            skin: "green",
            content: '参数错误',
            okBtn: false,
            cancelBtn: false
        });
        return false;
    }
    var return_val = false;
    $.ajax({
        type: 'post',
        url: ApiUrl + '/member/store/favorite/add',
        data: {
            token: key,
            storeId: storeId
        },
        dataType: 'json',
        async: false,
        success: function(result) {
            if (result.code == 200) {
                // $.sDialog({skin: "green", content: "收藏成功！", okBtn: false, cancelBtn: false});
                return_val = true;
            } else {
                $.sDialog({
                    skin: "blue",
                    content: result.datas.error,
                    okBtn: false,
                    cancelBtn: false
                });
            }
        }
    });
    return return_val;
}
/**
 * 取消收藏店铺
 */
function dropFavoriteStore(storeId) {
    var key = checkLoginByCookie(1);
    if (storeId <= 0) {
        $.sDialog({
            skin: "green",
            content: '参数错误',
            okBtn: false,
            cancelBtn: false
        });
        return false;
    }
    var return_val = false;
    $.ajax({
        type: 'post',
        url: ApiUrl + '/member/store/favorite/delete',
        data: {
            token: key,
            storeId: storeId
        },
        dataType: 'json',
        async: false,
        success: function(result) {
            if (result.code == 200) {
                return_val = true;
            } else {
                $.sDialog({
                    skin: "blue",
                    content: result.datas.error,
                    okBtn: false,
                    cancelBtn: false
                });
            }
        }
    });
    return return_val;
}
/**
 * 收藏商品
 */
function favoriteGoods(commonId) {
    var key = checkLoginByCookie(1);
    if (commonId <= 0) {
        $.sDialog({
            skin: "green",
            content: '参数错误',
            okBtn: false,
            cancelBtn: false
        });
        return false;
    }
    var return_val = false;
    $.ajax({
        type: 'post',
        url: ApiUrl + '/member/goods/favorite/add',
        data: {
            token: key,
            commonId: commonId
        },
        dataType: 'json',
        async: false,
        success: function(result) {
            if (result.code == 200) {
                // $.sDialog({skin: "green", content: "收藏成功！", okBtn: false, cancelBtn: false});
                return_val = true;
            } else {
                $.sDialog({
                    skin: "blue",
                    content: result.datas.error,
                    okBtn: false,
                    cancelBtn: false
                });
            }
        }
    });
    return return_val;
}
/**
 * 取消收藏商品
 */
function dropFavoriteGoods(commonId) {
    var key = checkLoginByCookie(1);
    if (commonId <= 0) {
        $.sDialog({
            skin: "green",
            content: '参数错误',
            okBtn: false,
            cancelBtn: false
        });
        return false;
    }
    var return_val = false;
    $.ajax({
        type: 'post',
        url: ApiUrl + '/member/goods/favorite/delete',
        data: {
            token: key,
            commonId: commonId
        },
        dataType: 'json',
        async: false,
        success: function(result) {
            if (result.code == 200) {
                return_val = true;
            } else {
                $.sDialog({
                    skin: "blue",
                    content: result.datas.error,
                    okBtn: false,
                    cancelBtn: false
                });
            }
        }
    });
    return return_val;
}
/**
 * 动态加载css文件
 * @param css_filename css文件路径
 */
function loadCss(css_filename) {
    var link = document.createElement('link');
    link.setAttribute('type', 'text/css');
    link.setAttribute('href', css_filename);
    link.setAttribute('href', css_filename);
    link.setAttribute('rel', 'stylesheet');
    css_id = document.getElementById('auto_css_id');
    if (css_id) {
        document.getElementsByTagName('head')[0].removeChild(css_id);
    }
    document.getElementsByTagName('head')[0].appendChild(link);
}
/**
 * 动态加载js文件
 * @param script_filename js文件路径
 */
function loadJs(script_filename) {
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', script_filename);
    script.setAttribute('id', 'auto_script_id');
    script_id = document.getElementById('auto_script_id');
    if (script_id) {
        document.getElementsByTagName('head')[0].removeChild(script_id);
    }
    document.getElementsByTagName('head')[0].appendChild(script);
}

(function() {
    Nc.number || (Nc.number = {
        /**
         * 四舍五入
         * @param number 数字
         * @param fractionDigits 保留小数位数
         * @returns {number}
         */
        round: function(number, fractionDigits) {
            return Math.round(number * Math.pow(10, fractionDigits)) / Math.pow(10, fractionDigits);
        },

        /**
         * 加法运算
         */
        add: function(num1, num2) {
            var baseNum, baseNum1, baseNum2;
            num1 = parseFloat(num1, 10);
            num2 = parseFloat(num2, 10);
            try {
                baseNum1 = num1.toString().split(".")[1].length;
            } catch (e) {
                baseNum1 = 0;
            }
            try {
                baseNum2 = num2.toString().split(".")[1].length;
            } catch (e) {
                baseNum2 = 0;
            }
            baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
            return (num1 * baseNum + num2 * baseNum) / baseNum;
        },
        /**
         * 减法运算
         */
        sub: function(num1, num2) {
            var baseNum, baseNum1, baseNum2;
            var precision; // 精度
            num1 = parseFloat(num1, 10);
            num2 = parseFloat(num2, 10);
            try {
                baseNum1 = num1.toString().split(".")[1].length;
            } catch (e) {
                baseNum1 = 0;
            }
            try {
                baseNum2 = num2.toString().split(".")[1].length;
            } catch (e) {
                baseNum2 = 0;
            }
            baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
            precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2;
            return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision);
        },
        /**
         * 乘法运算
         */
        multi: function(num1, num2) {
            var baseNum = 0;
            num1 = parseFloat(num1, 10);
            num2 = parseFloat(num2, 10);
            try {
                baseNum += num1.toString().split(".")[1].length;
            } catch (e) {}
            try {
                baseNum += num2.toString().split(".")[1].length;
            } catch (e) {}
            return Number(num1.toString().replace(".", "")) * Number(num2.toString().replace(".", "")) / Math.pow(10, baseNum);
        },
        /**
         * 除法运算
         */
        div: function(num1, num2) {
            var baseNum1 = 0,
                baseNum2 = 0;
            num1 = parseFloat(num1, 10);
            num2 = parseFloat(num2, 10);
            var baseNum3, baseNum4;
            try {
                baseNum1 = num1.toString().split(".")[1].length;
            } catch (e) {
                baseNum1 = 0;
            }
            try {
                baseNum2 = num2.toString().split(".")[1].length;
            } catch (e) {
                baseNum2 = 0;
            }
            with(Math) {
                baseNum3 = Number(num1.toString().replace(".", ""));
                baseNum4 = Number(num2.toString().replace(".", ""));
                return (baseNum3 / baseNum4) * pow(10, baseNum2 - baseNum1);
            }
        },
        /**
         * 数组内数字相乘
         * @param  {[type]} arr [description]
         * @return {[type]}     [description]
         */
        mMulti: function mMulti(arr) {
                var r = 0;
                if (Nc.isArray(arr)) {
                    arr.forEach(function(n) {
                        var _t = parseFloat(n);
                        if (!isNaN(_t)) {
                            r = r === 0 ? n : Nc.number.multi(n, r);
                        }
                    });
                } else {
                    for (var i = 0; i < arguments.length; i++) {
                        var _t = parseFloat(arguments[i]);
                        if (!isNaN(_t)) {
                            r = r === 0 ? _t : Nc.number.multi(_t, r);
                        }

                    }
                }
                return r;
            }
            /////
    });

    /**
     * 格式数字
     * @param value 需要处理的数值
     * @param min 最小限制
     * @param max
     * @param isFormat
     */
    Nc.getFormatNum = function(value, min, max, isFormat) {
        var _getNum = function(value) {
                var a = value.replace(/[^0-9|.]/ig, "");
                return parseFloat(a, 10);
            },
            a = _getNum(value),
            _isF = typeof isFormat != 'undefined';
        if (isNaN(a)) {
            a = min;
        }
        if (a - max > 0) {
            a = max;
        }
        if (a - min < 0) {
            a = min;
        }
        return _isF ? Nc.priceFormat(a) : a;
    };
    /**
     * 添加一个 priceFormat 设置成 '&yen;%s' 会出现钱币符号
     */
    Nc.priceFormat = function(price, priceFormat) {
        price = Nc.numberFormat(price, 2);
        return Nc.isEmpty(priceFormat) ? price : priceFormat.replace('%s', price);
    };

    Nc.numberFormat = function(num, ext) {
        if (ext < 0) {
            return num;
        }
        num = Number(num);
        if (isNaN(num)) {
            num = 0;
        }
        var _str = num.toString();
        var _arr = _str.split('.');
        var _int = _arr[0];
        var _flt = _arr[1];
        if (_str.indexOf('.') == -1) {
            /* 找不到小数点，则添加 */
            if (ext == 0) {
                return _str;
            }
            var _tmp = '';
            for (var i = 0; i < ext; i++) {
                _tmp += '0';
            }
            _str = _str + '.' + _tmp;
        } else {
            if (_flt.length == ext) {
                return _str;
            }
            /* 找得到小数点，则截取 */
            if (_flt.length > ext) {
                _str = _str.substr(0, _str.length - (_flt.length - ext));
                if (ext == 0) {
                    _str = _int;
                }
            } else {
                for (var i = 0; i < ext - _flt.length; i++) {
                    _str += '0';
                }
            }
        }

        return _str;
    };
    /**
     * 获取数字
     */
    Nc.getNum = function(text) {
        return text.replace(/[^0-9]/ig, "");
    };
    ///
    ///
    /**
     * 直接跳转页面
     * @param url [url 链接地址 ]
     */
    Nc.go = function(url) {
        !Nc.isEmpty(url) ? window.location = url : location.reload();
    };
})();



/**
 * 根据客户端不同，返回不同价格 appPrice0/wechatPrice0
 */
function getPrice0(goods) {
    if (getClientType() == "wechat") {
        return Nc.priceFormat(goods.wechatPrice0);
    } else {
        return Nc.priceFormat(goods.appPrice0);
    }
}

/**
 * 根据客户端不同，返回不同价格 appPrice1/wechatPrice1
 */
function getPrice1(goods) {
    if (getClientType() == "wechat") {
        return Nc.priceFormat(goods.wechatPrice1);
    } else {
        return Nc.priceFormat(goods.appPrice1);
    }
}

/**
 * 根据客户端不同，返回不同价格 appPrice2/wechatPrice2
 */
function getPrice2(goods) {
    if (getClientType() == "wechat") {
        return Nc.priceFormat(goods.wechatPrice2);
    } else {
        return Nc.priceFormat(goods.appPrice2);
    }
}

/**
 * 根据客户端不同，返回不同促销进行状态
 */
function getUsable(goods) {
    if (getClientType() == "wechat") {
        return goods.wechatUsable;
    } else {
        return goods.appUsable;
    }
}

/**
 * 根据客户端不同，返回不同最低价格
 */
function getPriceMin(goods) {
    if (getClientType() == "wechat") {
        return Nc.priceFormat(goods.wechatPriceMin);
    } else {
        return Nc.priceFormat(goods.appPriceMin);
    }
}
/**
 *  bycj -- 根据刻划断不同获取不同的推广佣金
 */
function getDistCommission(goods) {
    if (getClientType() == "wechat") {
        return goods.wechatCommission;
    } else {
        return goods.appCommission;
    }   
}


/**
 * 格式化日期
 */
(function(win) {
    Date.prototype.format  =   function(format) {
        if (Nc.isEmpty(format)) {
            format = 'yyyy-MM-dd hh:mm:ss';
        }    
        var  o  =      {        
            "M+" :  this.getMonth() + 1,
              //month
                    "d+" :  this.getDate(),
                 //day
                    "h+" :  this.getHours(),
                //hour
                    "m+" :  this.getMinutes(),
              //minute
                    "s+" :  this.getSeconds(),
              //second
                    "q+" :  Math.floor((this.getMonth() + 3) / 3),
               //quarter
                    "S" :  this.getMilliseconds()  //millisecond
                    
        }    
        if (/(y+)/.test(format))     format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4  -  RegExp.$1.length));    
        for (var  k  in  o)    
            if (new  RegExp("(" +  k  + ")").test(format))     format  =  format.replace(RegExp.$1, RegExp.$1.length == 1  ?  o[k]  :  ("00" +  o[k]).substr(("" +  o[k]).length));    
        return  format;
    }



})(window);
/**
 * 字符串转义
 * @return {[type]} [description]
 */
(function() {
    var escapeMap = {
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        "'": '&#x27;',
        '`': '&#x60;'
    };

    var createEscaper = function(map) {
        var escaper = function(match) {
            return map[match];
        };
        // Regexes for identifying a key that needs to be escaped
        var source = '(?:' + Object.keys(map).join('|') + ')';
        var testRegexp = RegExp(source);
        var replaceRegexp = RegExp(source, 'g');
        return function(string) {
            string = string == null ? '' : '' + string;
            return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
        };
    };
    Nc.escape = createEscaper(escapeMap);
})();

/**
 * 字符传替换
 * 
 * 
 *
 *  例子：
 *  "_{a|escape}_".ncReplaceTpl({'a': '<p>1</p>' })　//=>"_&lt;p&gt;1&lt;/p&gt;_"
 * 
 */
(function() {
    /**
     * 过滤器,如果需要统一在这里添加
     */
    var ncReplaceTplFilters = {
        //字符串转义
        escape: function(str) {
            return  Nc.escape(str);
        }
    };
    function _getValue(value  , filters) {
        if (!filters.length) return value;
        var _value = value;
        filters.forEach(function(currValue) {
            var a = ncReplaceTplFilters[currValue] ? ncReplaceTplFilters[currValue](_value) : _value;
            _value = typeof a == 'undefined' ? _value : a;
        });
        //如果出现
        return typeof _value == 'undefined' ? obj.value : _value;
    }
    var ReplaceTpl = function(str, o) {
        return str.replace(/\\?\{([^{}]+)\}/g, function(match, name) {
            var _f = name.split("|") , 
                _filters =_f.length ? _f.slice(1, _f.length) : null
            ;
            name = _f[0] ; 
            return (o[name] === undefined) ? '' : _getValue(o[name] , _filters);
        });
    };
    String.prototype.ncReplaceTpl = function(option) {
        return ReplaceTpl(this, option);
    };
})();
(function($) {
    jQuery.fn.extend({
        ncCheckBox: function() {
            return $(this).each(function() {
                var $this = $(this),
                    target = $($this.data("ncTarget")),
                    yesValue = $this.data("ncYes"),
                    noValue = $this.data("ncNo");
                if (target.length === 0 || yesValue == undefined || noValue == undefined) {
                    return;
                }
                $this.on("change", function() {
                    var _this = $(this);
                    _this.is(":checked") ? target.val(yesValue) : target.val(noValue)
                })
            })
        }
    })
})(jQuery);

/**
 * 代金卷插件
 */
(function($) {

    var __postFlat = true;

    var NcVoucherShow = function(option) {
        $.extend(this, NcVoucherShow.defaultsOptions, option);

        //没登陆获取优惠券地址
        this.noLoginVoucherUrl = this.apiUrl + this.noLoginVoucherUrl;
        //登录后获取优惠卷地址
        this.loginedVoucherUrl = this.apiUrl + this.loginedVoucherUrl;

        this.receiveUrl = this.apiUrl + this.receiveUrl;

        this._init();
    };

    NcVoucherShow.defaultsOptions = {
        //模版
        tplPanel: '<div id="voucherSelected">' + '<div class="nctouch-full-mask left">' + '<div class="nctouch-full-mask-bg"></div>' + '<div class="nctouch-full-mask-block">' + '<div class="header">' + '<div class="header-wrap">' + '<div class="header-l"><a href="javascript:void(0);" id="vClose"><i class="back" ></i></a></div>' + '<div class="header-title">' + '<h1>优惠券</h1>' + '</div>' + '<div class="header-r"><a href="javascript:void(0);"><i class="close"></i></a></div>' + '</div>' + '</div>' + '<div class="nctouch-main-layout">' + '<div class="nctouch-main-layout-a coupon_container"><ul class="nctouch-default-list coupon_list">' + '{body}' + '</ul></div>' + '</div>' + '</div>' + '</div>' + '</div>',
        liPanel: '<li class="qq_coupon <% if(memberIsReceive == 1 ) { %>used<% } %>"><div class="bg_coupon"><span class="coupon_price"><%= templatePrice %></span><dl><dt>元优惠券</dt><dd class="coupon_rule"><%= templateTitle %>-满<%= priceFormat(limitAmount) %>元可用</dd></dl><div class="coupon_btn" <% if(memberIsReceive != 1) {%> data-linqu-btn="<%=templateId%>" <% } %> ><span><% if(memberIsReceive == 1 ) { %>已领取<% }else { %>点击领取<% } %></span></div></div><div class="coupon_date">使用期限：<%= useStartTimeText %> 至 <%= useEndTimeText %></div></li>',
        //优惠卷为空的模版
        tplEmpty:'<div class="nctouch-norecord voucher"><div class="norecord-ico"><i></i></div><dl><dt>店铺中没有相关的优惠券</dt><dd>店铺优惠券可享受商品折扣</dd></dl></div>',
        //未登录获取代金券
        noLoginVoucherUrl: '/store/voucher?storeId=',

        loginedVoucherUrl: '/member/voucher/template/free',

        //领取优惠券的地址
        receiveUrl: '/member/voucher/receive/free',
        apiUrl: ''
    };

    NcVoucherShow.prototype._init = function() {
        var self = this;

        template.helper('priceFormat',Nc.priceFormat);

        this._buildElement(function(voucherTemplateList) {
            var _html = '';
            $("body").find('#voucherSelected').length && $("body").find('#voucherSelected').remove()
            _html = voucherTemplateList.map(function(currValue) {
                return template.compile(self.liPanel)(currValue);
            }).join("");
            $('body').append(self.tplPanel.ncReplaceTpl({
                body: _html == '' ? self.tplEmpty : _html
            }));

            //添加滑动特效
            typeof myScrollVoucher != 'undefined' && myScrollVoucher.destroy()
            if (_html !='') {
                myScrollVoucher = new IScroll('#voucherSelected .nctouch-main-layout-a', {
                    mouseWheel: true,
                    click: true
                });
            }

            self._bindEvent();
        });

    };
    NcVoucherShow.prototype._buildElement = function(cb) {
        var self = this;

        if (__postFlat == false) return;
        __postFlat = false;

        if (Nc.isEmpty(self.token)) {
            $.getJSON(self.noLoginVoucherUrl + self.storeId, function(xhr) {
                if (xhr.code !== 200) return;
                cb(xhr.datas.voucherTemplateList);
            }).always(function() {
                __postFlat = true;
            });
        } else {
            $.post(self.loginedVoucherUrl, {
                storeId: self.storeId,
                token: self.token
            }, function(xhr) {
                if (xhr.code !== 200) return;
                cb(xhr.datas.voucherTemplateList);
            }).always(function() {
                __postFlat = true;
            });
        }



    };
    NcVoucherShow.prototype._bindEvent = function() {
        var self = this;
        /**
         *  领取代金券上的点击点击关闭
         */
        $('#vClose').off("click").on('click', function(event) {
            event.preventDefault();
            $('#voucherSelected').find('.nctouch-full-mask').addClass('right').removeClass('left');
        });

        /**
         * 点击领卷
         */
        $('#voucherSelected').on('click', '[data-linqu-btn]', function(event) {
            event.preventDefault();
            var $this = $(this),
                tid = $(this).data("linquBtn"),
                $par = $(this).closest('li.qq_coupon');
            if ($par.hasClass('used')) return;
            self._vrf(tid, function(xhr) {
                if (xhr.code == 200) {
                    $this.find("span").html("已领取");
                    $par.addClass('used');
                }
            });
        });
    };

    /**
     * 领取代金券
     */
    NcVoucherShow.prototype._vrf = function(tid, callBack) {
        var self = this;
        if (__postFlat == false) return;
        __postFlat = false;
        $.post(self.receiveUrl, {
            token: self.token,
            templateId: tid
        }, function(xhr) {
            callBack(xhr);
        }).always(function() {
            __postFlat = true;
        });
    }
    jQuery.extend({
        ncVoucherShow: function(ops) {
            return new NcVoucherShow(ops);
        }
    })
})(jQuery);
/**
 * 统一验证是否登陆
 */
$.ajaxSetup({
    //不需要401验证的页面
    ncVerifyLoginNoVerfiy:[
        "/wap/tmpl/show_orders_detail.html"
    ],
    //不需要401 验证的post 地址
    ncNoLoginPostUrl :[
       IMUrl + '/get_unread_msg_count'
    ] , 
    ncVerifyLogin: function(xhr, statusText, jqXHR) {
        if (xhr.code == 401) {
            //清空cookie
            delCookie('key');

            //查询是否开启了微信登录
            var weixinLogin = 0;
            if (getClientType()=="wechat") {
                $.ajax({
                    url:ApiUrl + '/loginconnect/state',
                    type:'get',
                    async:false,
                    success:function(result){
                        if (result.datas.weixinLogin == 1) {
                            weixinLogin = 1;
                        }
                    }
                });
            }
            addCookie("referurl", window.location.href, 0);
            if (getClientType()=="wechat" && weixinLogin==1 && getCookie('hasAutologin')!=1) {
                //微信端且开启了微信登录且未经过自动登录则进行静默授权登录，并防止重复执行自动登录形成死循环
                window.location.href = ApiUrl+'/loginconnect/wap/weixin/auto';
            } else {
                window.location.href = WapSiteUrl + '/tmpl/member/login.html';
            }
            return false;
        }
        return true;
    }
});

/**
 * 验证时否是手机号
 */
function isMobile(value) {
    return /^0?(13|15|17|18|14)[0-9]{9}$/.test(value) ; 
}
/**
 * 展示微信关注提示框
 * @param type 关注的类型goods等
 * @param params json数据,关注所需参数
 * @returns {boolean}
 */
function showWeixinSubscribe(type, params){
    var isShowSubscribe = false;
    if (getClientType()!="wechat") {
        //只有微信端显示
        return isShowSubscribe;
    }
    var token = getCookie('key');
    if (!token) {
        //只有登录后显示
        return isShowSubscribe;
    }
    params.type = type;
    params.token = token;
    //获得二维码图片
    $.ajax({
        url:ApiUrl + '/weixin/subscribe',
        type:'post',
        data: params,
        async:false,
        success:function(result){
            if (result.code==200 && result.datas.isSubscribe==0 && result.datas.qrcodeUrl) {
                //未关注弹出关注提示框
                $.sOpenLayer({
                    skin: "pink",
                    width: 522,
                    height: 566,
                    title: "",
                    content: '<img src="'+result.datas.qrcodeUrl+'" />'
                });
                isShowSubscribe = true;
                return isShowSubscribe;
            }
        }
    });
    return isShowSubscribe;
}



